Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Using the TABLE-HANDLE form
The third parameter form is unique to temp-tables, and this is the
TABLE-HANDLE. You can use aTABLE-HANDLEto either pass or receive a dynamic temp-table, just as you would use theTABLEparameter form to pass a static temp-table.To run a routine and pass a temp-table to or from the routine using a table handle, use this syntax:
In the called routine, you define the parameter like this:
The
tt-handlehandle itself is exactly the same value you would pass as an ordinaryHANDLE. However, theTABLE-HANDLEkeyword tells Progress to pass not just the handle value but the entire definition and contents of the table as well, in exactly the same form as theTABLEparameter form uses.You use the
TABLE-HANDLEform to pass a dynamic temp-table and its description to another routine, or to receive a temp-table as a dynamic parameter from another routine, whether in the same session or on the other side of an AppServer connection. The corresponding parameter in the other routine can be a staticTABLEor a dynamicTABLE-HANDLE.The flexibility the
TABLE-HANDLEform provides you is extremely valuable. For example, you might have procedures running on the server that represent business logic defined against static tables. On that side of the application, you can build static temp-tables that include database fields, calculated fields, and other elements. You can then pass the temp-table to the client using theTABLEparameter form, since you have a static temp-table definition locally.On the client side of the application, you might have general purpose procedures to retrieve temp-tables from the server, perhaps to display data, allow updates, and do other client-side processing that might apply to many different tables received from the server. A general-purpose procedure that has no specific single temp-table definition can receive the table as a
TABLE-HANDLE. It receives the entire table definition and data from the caller and can access it through the handle.All combinations of
TABLEandTABLE-HANDLEare valid. You can pass a static table using theTABLEform and receive it as a dynamicTABLE-HANDLE. You can pass aTABLEand receive it as a staticTABLEof the same or compatible definition. You can pass a dynamicTABLE-HANDLEand receive it as a staticTABLE, and you can pass a dynamicTABLE-HANDLEand receive it as a dynamicTABLE-HANDLEon the other side.Use the
TABLE-HANDLEform when the temp-table is not defined locally and you need to access it in a general way through its handle and buffer handle. Use theTABLEform when the temp-table is defined locally with a staticDEFINEstatement.To review, Table 20–2 summarizes the possible combinations of temp-table parameter definitions in the routine making the call and the routine being called, along with their effects on the temp-table.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |